UseEffect reads value correctly but value is undefined if accessed elsewhere

welcome to shbcf.ru